package cn.hahah.module.blog.dal.mysql.userhistorysearch;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.userhistorysearch.UserHistorySearchDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.userhistorysearch.vo.*;

/**
 * 用户搜索记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserHistorySearchMapper extends BaseMapperX<UserHistorySearchDO> {

    default PageResult<UserHistorySearchDO> selectPage(UserHistorySearchPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserHistorySearchDO>()
                .eqIfPresent(UserHistorySearchDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserHistorySearchDO::getContent, reqVO.getContent())
                .betweenIfPresent(UserHistorySearchDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UserHistorySearchDO::getId));
    }

}